<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>后台管理面板</title>
  <!-- 告诉浏览器该页面是自适应布局 -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <include file="common/top" />
</head>
<body class="hold-transition skin-blue sidebar-mini">	
<div class="wrapper">
    <div class="content-wrapper" style="margin-left: 0 !important;">
        <!--页眉-->
        <section class="content-header">
          <h1>栏目列表</h1>
        </section>
        <!--内容开始-->
        <section class="content">
            <div class="search">
                 <input class="btn btn-flat btn-primary m_10" onclick="location.href='{{:url('index')}}'" type="button" value="显示全部">
                 <input class="btn btn-flat btn-warning m_10 select_del" type="button" value="批量删除">
                 <a class="btn btn-flat btn-success m_10 f_r" href='{{:url('add')}}'><i class="fa fa-plus m-r-10"></i>添 加</a>
            </div>
            <!--数据表开始-->
            <div class="row">
                <div class="col-xs-12">
                  <div class="box">
                    <div class="box-header">
                    <!-- /.box-header -->
                    <div class="box-body table-responsive no-padding">
                      <table class="table table-bordered table-hover">
                        <tr>
                          <th class="t_c"><input type="checkbox" id="check"></th>
                          <th class="t_c">ID</th>
                          <th>分类名称</th>
                          <th class="t_c">层级关系</th>
                          <th class="t_c">内容模型</th>
                          <th class="t_c">列表页模板</th>
                          <th class="t_c">状态</th>
                          <th class="t_c">排序</th>
                          <th class="t_c">操作</th>
                        </tr>
                        <volist name="categorylists" id="vocate">
                        <tr>
                        	<td class="t_c"><input type="checkbox" name="key[]" value="{{$vocate.id}}"></td>
                          <td class="t_c">{{$vocate.id}}</td>
                          <td><a href="{{:url('article/index',['cid'=>$vocate.id])}}">{{$vocate.name}}</a></td>
                          <td class="t_c">{{$vocate.path}}</td>
                          <td class="t_c">{{$vocate.mcode|get_mcode_name}}</td>
                          <td class="t_c">{{$vocate.listtpl}}</td>
                          <td class="t_c">
                          	<eq name="vocate.status" value="1">
                          		<a class="state state_ok is_next" data-id="{{$vocate.id}}"><i class="fa fa-fw fa-check-square"></i></a>
                          	<else/>
                          		<a class="state state_no is_next" data-id="{{$vocate.id}}"><i class="fa fa-fw fa-check-square"></i></a>
                          	</eq>
                          </td>
                          <td class="t_c">
                          	<input class="form-control input-sm w_40 m_auto changeSort" type="text" value="{{$vocate.sort}}" data-id="{{$vocate.id}}">
                          </td>
                          <td class="t_c">
                              <if condition="hasChild($vocate.id) neq true">
                          	  <a class="btn btn-flat btn-success btn-xs" href="{{:url('article/add', array('cid' => $vocate['id']))}}">
                                <i class="fa fa-plus"></i> 添加
                              </a>
                              </if>
	                          <a class="btn btn-flat btn-info btn-xs" href="{{:url('category/edit', array('id' => $vocate['id']))}}">
                                <i class="fa fa-edit"></i> 编辑
                              </a>
                              <a class="btn btn-flat btn-warning btn-xs list_del" data-id="{{$vocate['id']}}">
                                <i class="fa fa-trash-o"></i> 删除
                              </a>
                          </td>
                        </tr>
                        </volist>                       
                      </table>
                    </div>
                    <!-- /.box-body -->
                  </div>
                  <!-- /.box -->
                </div>
              </div>
            <!--数据表结束-->
        </section>
        <!-- right col -->
      </div>
      <!-- /.row (main row) -->

    </section>
        <!--内容结束-->
    </div>
</div>
  <include file="common/bottom" />

<script>
	//排序
	$(".changeSort").blur(function(){
		var url = "{{:url('sort')}}";
		var id = $(this).data("id");
		var sort = $(this).val();
		changeSort(url,id,sort);
	})
	
	
	//设置跳转下级
	$(".is_next").click(function(){
		var url = "{{:url('category/editstatus')}}";
		var id = $(this).data("id");
		changeState(url,id);
	})
	
	//删除
	$(".list_del").click(function(){
		var url = "{{:url('category/deletes')}}";
		var id = $(this).data("id");
		delOne(url,id)
	})
	
	//批量删除
	$(".select_del").click(function(){
		var url = "{{:url('selectDel')}}";
		delSelect(url);
	})
	
</script>
</body>
</html>    